1. Technical Field
The present invention relates generally to an improved distributed data processing system, and, in particular to an improved system, method, and computer program product within an object oriented environment. Still more particularly, the present invention relates to a system, method, and computer program product for storage of attribute data in an object oriented environment in such a manner as to reduce the logic to store attributes and the amount of storage space for those attributes.
2. Description of Related Art
Object-oriented languages have been employed in creating applications. One of the big advantages of object-oriented languages is the ability to reuse portions of the software code. Reuse of the code is achieved through inheritance. In many cases, inheritance can make development of new classes very simple because the logic of a parent class need not be reinvented for each child of that parent class.
This advantage does not normally apply, however, to functions that act on the attributes of a class. These functions must be rewritten for each subclass so that the attributes of each subclass are acted upon. One such example is when the attributes of an object must be converted to another representation, such as XML data, or a byte stream.
FIG. 1 depicts an object definition having attributes defined within classes and having attribute data stored within the class in which the attribute is defined in accordance with the prior art. Object 10 includes an ID class 12, a person class 14, and a customer class 16. Person class 14 is a subclass of ID class 12. And, customer class 16 is a subclass of person class 14.
An object identifier (ID) attribute is defined within ID class 12. A first name attribute and a last name attribute are defined within person class 14. A customer number attribute and a last visit date attribute are defined within customer class 16. The object identifier data will be stored in ID class 12. The first name data and last name data will both be stored in the person class 14. The customer number data and last visit date data will both be stored in the customer class 16. Thus, the attribute data is stored within the class in which the associated attribute is defined.
FIG. 2 illustrates a particular instance of an object 20, having an object definition defined as depicted by FIG. 1, in accordance with the prior art. An object identifier, “12345”, is stored within ID class 22. A first name, “John”, and a last name, “Doe”, are both stored within person class 24. A customer number, “3413523”, and a last visit date, “Mar. 12, 2001”, are both stored within customer class 26.
Methods, or logic, that need to act upon all attribute data of object 10 must be written for each class for which one or more attributes are defined. As depicted by FIG. 2, a “read object” method and a “write object” method are both defined within each class, i.e. ID class 22, person class 24, and customer class 26. The “read object” method will read all of the attribute data for only the class within which the “read object” method is defined. Similarly, the “write object” method will write all of the attribute data for only the class within which the “write object” method is defined. In order to act upon all attribute data of object 20, these methods must be defined for each class of object 20.
The read and write object methods defined within ID class 22 will read and write only the object ID data, “12345”. The read and write object methods defined within person class 24 will read and write only the first name and last name data, “John” and “Doe”. The read and write object methods defined within customer class 26 will read and write only the customer number and last visit date data, “3413523” and “Mar. 12, 2001”.
Thus, as depicted by FIGS. 1 and 2, the code, or logic, must be written for each class of an object in order to act upon all of the attributes of the object.
Therefore, it would be advantageous to have an improved method, system, and product for storage of attribute data in an object oriented environment in such a manner as to reduce attribute logic contained in the “readObject” and “writeObject” methods.